import React from 'react'
import * as echarts from 'echarts'

export default function Home() {
  React.useEffect(() => {
    initEcharts()
  }, [])
  function initEcharts() {
    const myEcharts = echarts.init(document.getElementById("echarts"))
    const option = {
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          data: [150, 230, 224, 218, 135, 147, 260],
          type: 'line'
        }
      ]
    };
    myEcharts.setOption(option)
    window.addEventListener('resize', function () {
      myEcharts.resize();
    });
  }
  return (
    <div id='echarts' style={{ height: 400 }}></div>
  )
}
